<?php


namespace app\api\validate;


use think\Validate;

class TopicValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'major_id' => 'require',
        'type_id'=>'require',
        'degree_id'=>'require',
        'time'=>'require',
        'title'=>'require|max:50',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'major_id.require' => '请选择科目！',
        'type_id.require' => '请选择题型！',
        'degree_id.require' => '请选择难易程度！',
        'time.require' => '请选择答题时间！',
        'title.require' => '请填写试卷名称！',
        'title.max' => '试卷名称不能超过50位！',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'create' => ['majors_id','type_id','degree_id','title','time'],
    ];
}